package com.xy.webadmin.excel.strategy;

import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Configuration
public class ExcelStrategyFactory {

    @Resource
    private List<ExcelStrategy> excelStrategyList;

    @Bean("excelStrategyMap") // 指定 Bean 名称

    public Map<String, ExcelStrategy<?>> excelStrategyStrategies() {
        Map<String, ExcelStrategy<?>> strategyMap = new HashMap<>();

        for (ExcelStrategy excelStrategy : excelStrategyList) {

            strategyMap.put(excelStrategy.getStrategyClassStr(), excelStrategy);

        }
        return strategyMap;
    }


}
